#ifndef _FIRSTPERSONHANDLER_H_
#define _FIRSTPERSONHANDLER_H_

#include <SEEdit/EventHandlers/CameraEventHandler.h>
#include <glm/glm.hpp>
#include <SECore/Signal.h>

namespace SEngine
{
    class FirstPersonHandler : public CameraEventHandler
    {
    public:
        FirstPersonHandler(EnableEventHandle & enHandle, Camera & camera);
        virtual ~FirstPersonHandler() = default;
    
        virtual void OnEvent(EventPtr) override;
        virtual void OnUpdate(int delta) override;

        void MoveTarget(glm::vec3 target);

        float GetMoveSpeed() { return m_moveSpeed; }
    
    protected:
        void OnMousePressEvent(MousePressEventPtr) {}
        void OnMouseReleaseEvent(MouseReleaseEventPtr) {}
        void OnMouseMoveEvent(MouseMoveEventPtr);
        void OnMouseWheelEvent(MouseWheelEventPtr);
        void OnKeyPressEvent(KeyPressEventPtr e);
        void OnKeyReleaseEvent(KeyReleaseEventPtr e);
    
    private:
        float m_moveSpeed{0.1f};
        float m_rotateSpeed{0.05f};
        glm::vec3 m_targetPos{0.0f};
        glm::vec3 m_targetFront{0.0f};
        glm::vec2 m_lastPos{0.0f};
        float m_delta;
    };
}

#endif